package io.renren.config.rabbitmq;


import com.alibaba.fastjson.JSON;
import io.renren.modules.app.entity.UserEntity;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 消息消费者1
 * @author zhuzhe
 * @date 2018/5/25 17:32
 * @email 1529949535@qq.com
 */
//@Component
public class FirstConsumer {

    @RabbitListener(queues = {"first-queue","second-queue"}, containerFactory = "rabbitListenerContainerFactory")
    public void handleMessage(String message) throws Exception {
        // 处理消息
        System.out.println("FirstConsumer，handleMessage :"+message+"开始处理业务信息");
        UserEntity userEntity = JSON.toJavaObject(JSON.parseObject(message),UserEntity.class);
        System.out.println("name:"+userEntity.getUsername());

    }
}

